import java.util.Scanner;

public class Prime {

    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        System.out.println("请输入一个数:");
        int num=sc.nextInt();
        int i=2;
        for ( i = 2; i < num/2 ; i++) {
            if( num % i == 0){
                System.out.println(num +"不是素数");
                break;
            }

        }
        if(num/2 < i){
            System.out.println(num + "是素数");
        }
    }
    public static void main1(String[] args) {
        Scanner sc= new Scanner(System.in);
        System.out.println("请输入一个数:");
        int num=sc.nextInt();
        int i=2;
        for ( i = 2; i < num ; i++) {
            if( num % i == 0){
                System.out.println(num +"不是素数");
                break;
            }

            }
        if(num == i){
            System.out.println(num + "是素数");
        }
    }
}
